//
//  ValueSlider.swift
//  animations
//
//  Created by Ekaterina on 16.01.2023.
//

import SwiftUI

struct ValueSlider: View {
    var title = ""
    var minValue = 0.0
    var maxValue = 0.0
    @Binding var value: Double
    
    var body: some View {
        VStack(alignment: .leading, spacing: 4) {
            Text("\(title) (\(String(format: "%.2f", value)))")
                .font(.system(size: 16, weight: .semibold))
            Slider(value: $value, in: minValue...maxValue) {
            } minimumValueLabel: {
                Text("\(minValue.formatted())").font(.system(size: 16)).frame(width: 35, alignment: .leading).lineLimit(1)
            } maximumValueLabel: {
                Text("\(maxValue.formatted())").font(.system(size: 16)).frame(width: 35, alignment: .trailing).lineLimit(1)
            }
        }
    }
}
